package com.xxx.video.commen.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class TimeUtils {
    private static  TimeUtils mTimeUtils = null;

    private TimeUtils() {}

    public static TimeUtils getInstance() {
        if (mTimeUtils == null) {
            synchronized (TimeUtils.class) {
                if (mTimeUtils == null) {
                    mTimeUtils = new TimeUtils();
                }
            }
        }
        return mTimeUtils;
    }

    public String getStringDate(long time, String formart) {
        String date = String.valueOf(time);
        if (date.length() <= 10) {
            time *= 1000L;
        }

        SimpleDateFormat formatter = new SimpleDateFormat(formart, Locale.getDefault());
        Date curDate = new Date(time);
        return formatter.format(curDate);
    }
}
